/**   
 * @Title: LotteryRecordDetailCommunicater.java 
 * @Package: com.esun.rabbit2.communicaters 
 * @Description: (用一句话描述该文件做什么) 
 * @Author: Billy qigs@500wan.com   
 * @Date: 2011-6-29 下午02:01:32  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Config;
import com.esun.config.Key;
import com.esun.model.LotteryRecordDetailInfo;
import com.esun.model.UserInfo;
import com.esun.network.ServerCommunicater;
import com.esun.util.log.EDebug;

/**
 * @ClassName: LotteryRecordDetailCommunicater
 * @Description: (购彩记录详情通讯接口)
 * @Author: Billy qigs@500wan.com
 * @Date: 2011-6-29 下午02:01:32
 */
public class LotteryRecordDetailCommunicater extends ServerCommunicater {
	private String USERSESSION = UserInfo.getUserInfo().getUserSession();

	public boolean isGetLotteryRecordDetail(String lotid, String pid) throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {
		boolean isSucceed = false;
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		list.add(mapItem(Config.PASER_MID, BussinessCode.MID_LOTRECORD_DETIAL));
		list.add(mapItem(Config.PASER_CK, USERSESSION));
		list.add(mapItem(Key.KEY_LOTID, lotid));
		list.add(mapItem(Key.KEY_PID, pid));

		super.getServerResponse(list, true);
		if (super.getState() == 100) {
			isSucceed = true;
		}

		return isSucceed;
	}

	public ArrayList<LotteryRecordDetailInfo> getLotteryRecordDetail() {
		ArrayList<LotteryRecordDetailInfo> list = new ArrayList<LotteryRecordDetailInfo>();
		int count = super.getListResult().size();
		for (int i = 0; i < count; i++) {
			LotteryRecordDetailInfo lotteryRecordDetail = new LotteryRecordDetailInfo();

			Hashtable<String, String> htListResult = super.getListResult().get(i);

			lotteryRecordDetail.setAddTime(htListResult.get(Key.KEY_ADDTIME));
			lotteryRecordDetail.setAllMoney(htListResult.get(Key.KEY_ALLMONEY));
			lotteryRecordDetail.setBeiShu(htListResult.get(Key.KEY_BEISHU));
			lotteryRecordDetail.setFenShu(htListResult.get(Key.KEY_ANUMBER));
			lotteryRecordDetail.setOneMoney(htListResult.get(Key.KEY_ONEMONEY));
			lotteryRecordDetail.setBaoDiMoney(htListResult.get(Key.KEY_BAODIMONEY));
			lotteryRecordDetail.setTiCheng(htListResult.get(Key.KEY_TICHENG));
			lotteryRecordDetail.setIsManYuan(htListResult.get(Key.KEY_ISMANYUAN));
			lotteryRecordDetail.setJinDu(htListResult.get(Key.KEY_RENQI));
			lotteryRecordDetail.setFileContent(htListResult.get(Key.KEY_FILEORCODE));
			lotteryRecordDetail.setLotteryCount(htListResult.get(Key.KEY_LOTTERYCOUNT));
			lotteryRecordDetail.setLotteryMoney(htListResult.get(Key.KEY_LOTTERYMONERY));
			lotteryRecordDetail.setLeftNumber(htListResult.get(Key.KEY_LEFTNUMBER));
			lotteryRecordDetail.setIssuc(htListResult.get(Key.KEY_ISSUC));
			lotteryRecordDetail.setUserName(htListResult.get(Key.KEY_USERNAME));
			lotteryRecordDetail.setIsHm(htListResult.get(Key.KEY_ISHM));
			lotteryRecordDetail.setBaoDi(htListResult.get(Key.KEY_BAODI));
			lotteryRecordDetail.setZhanJiJinPai(htListResult.get(Key.KEY_ZHANJI_JINPAI));
			lotteryRecordDetail.setZhanJiYinPai(htListResult.get(Key.KEY_ZHANJI_YINPAI));
			lotteryRecordDetail.setIsShow(htListResult.get(Key.KEY_ISSHOW));
			lotteryRecordDetail.setPlayID(htListResult.get(Key.KEY_PLAYID));
			lotteryRecordDetail.setProID(htListResult.get(Key.KEY_PROID));
			lotteryRecordDetail.setPlayName(htListResult.get(Key.KEY_PLAYNAME));
			lotteryRecordDetail.setState(htListResult.get(Key.KEY_LOTTERYSTATE));
			lotteryRecordDetail.setOpenCode(htListResult.get(Key.KEY_OPENCODE));
			lotteryRecordDetail.setExpect(htListResult.get(Key.KEY_EXPECT));
			lotteryRecordDetail.setWinMoney(htListResult.get(Key.KEY_GETMONEY));
			lotteryRecordDetail.setIsUpload(htListResult.get(Key.KEY_ISUPLOAD));
			lotteryRecordDetail.setGoldDiamond(htListResult.get(Key.KEY_ZHANJI_JINZUAN));
			lotteryRecordDetail.setGoldStar(htListResult.get(Key.KEY_ZHANJI_JINXING));
			lotteryRecordDetail.setSilverDiamond(htListResult.get(Key.KEY_ZHANJI_YINZUAN));
			lotteryRecordDetail.setSilverStar(htListResult.get(Key.KEY_ZHANJI_YINXING));
			lotteryRecordDetail.setGoldCup(htListResult.get(Key.KEY_ZHANJI_JINBEI));
			EDebug.o(htListResult.get(Key.KEY_ZHANJI_YINZUAN));
			EDebug.o(htListResult.get(Key.KEY_ZHANJI_JINZUAN));
			EDebug.o(htListResult.get(Key.KEY_ZHANJI_JINXING));
			EDebug.o(htListResult.get(Key.KEY_ZHANJI_YINXING));
			EDebug.o(htListResult.get(Key.KEY_ZHANJI_JINBEI));

			list.add(lotteryRecordDetail);
		}
		return list;
	}

	private HashMap<String, String> mapItem(String name, String value) {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put(name, value);
		return map;
	}
}
